package cn.hrlly.tao2shou.biz;

import com.zhy.http.okhttp.OkHttpUtils;

import cn.hrlly.tao2shou.other.Config;
import cn.hrlly.tao2shou.callback.PublishRequireCallback;
import cn.hrlly.tao2shou.domain.Require;
import cn.hrlly.tao2shou.listener.OnPublishRequireListener;

/**
 * User: gengliang
 * Date: 2016-01-30
 * Time: 11:03
 */

public class PublishRequireBizImpl implements PublishRequireBiz {

    private OnPublishRequireListener onPublishRequireListener;

    public PublishRequireBizImpl(OnPublishRequireListener onPublishRequireListener){
        this.onPublishRequireListener=onPublishRequireListener;
    }

    @Override
    public void getNetPublishRequire(Require require) {
        OkHttpUtils
                .post()
                .url(Config.key_url)
                .addParams(Config.key_action,Config.action_publish_require)
                .addParams(Config.key_require_title,require.getRequireTitle())
                .addParams(Config.key_require_description,require.getRequireDescription())
                .addParams(Config.key_acceptable_price, String.valueOf(require.getAcceptablePrice()))
                .build()
                .execute(new PublishRequireCallback(onPublishRequireListener));
    }
}
